﻿using SUNRPA.CONTROLS.IMPL.util;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Windows;

namespace SUNRPA.UPDATER {
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow:Window {
        public MainWindow() {
            InitializeComponent();
        }

        private void Update(object sender, RoutedEventArgs e) {
            App app =  (App)Application.Current;
            Stream? stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SUNRPA.UPDATER.patch.zip");
            CompressUtil.ZipDeCompress(stream, app.installDir);
            MessageBox.Show("更新完成，请重新启动程序");
            this.Close();
        }

        private void Cancel(object sender, RoutedEventArgs e) {
            this.Close();
        }
    }
}
